/*
 * @Author: ziqi jhzq12345678
 * @Date: 2024-10-24 17:40:42
 * @LastEditors: ziqi jhzq12345678
 * @LastEditTime: 2024-10-24 17:41:04
 * @FilePath: /pornhub_app/lib/src/views/launch/step1_page.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:pornhub_app/services/storage_service.dart';

import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:pornhub_app/views/launch/step2_page.dart';
import 'package:pornhub_app/views/mine/frontpage/open_password_page.dart';

class Step1Page extends StatefulWidget {
  const Step1Page({super.key});
  @override
  State<StatefulWidget> createState() {
    return LaunchState();
  }
}

class LaunchState extends State<Step1Page> {
  final strogeService = Get.find<StorageService>();
  ValueNotifier<bool> pass = ValueNotifier(false);
  @override
  void initState() {
    pass.value = strogeService.isAppLock;
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ValueListenableBuilder(
      valueListenable: pass,
      builder: (context, value, child) {
        return value
            ? OpenPasswordPage(back: () {
                pass.value = false;
              })
            : const Step2Page();
      },
    );
  }
}
